<!-- 转储状态 -->
<template>
  <div class="dashboard-editor-container">
    <el-row style="background: #fff; padding: 16px 16px;">
      <div>
        <el-table border :data="tableData" row-key="id" default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}" style="width: 100%; margin: 15px 0">
            <el-table-column type="index" width="50" label="序号"></el-table-column>
            <el-table-column prop="CreateTime" label="创建时间" align="left"></el-table-column>
            <el-table-column prop="UserName" label="终端用户" align="left"></el-table-column>
            <el-table-column prop="DumpStatus" label="转储状态" align="left">
              <template slot-scope="scope">
                <span v-if="scope.row.DumpStatus===0" style="color:#909399">等待执行</span>
                <span v-if="scope.row.DumpStatus===2" style="color:#67C23A">执行成功</span>
                <span v-if="scope.row.DumpStatus===1" style="color:#E6A23C">正在执行</span>
                <span v-if="scope.row.DumpStatus===3" style="color:#F56C6C">执行失败，错误码：{{scope.row.BackupStatus}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="DumpStartTime" label="转储开始" align="left"></el-table-column>
            <el-table-column prop="DumpEndTime" label="转储结束" align="left"></el-table-column>
            <el-table-column prop="time" label="转储耗时" align="left">
            </el-table-column>
        </el-table>
      </div>
    </el-row>
  </div>
</template>

<script>
import { connrequest } from "@/api/firstPage";
import { parseTime } from "@/utils/index.js";
export default {
    data(){
        return{
            tableData:[
                
            ]
        }
    },
    created(){
      this.getData();
    },
    methods:{
      async getData(){
        const res = await connrequest('GetDumpStatus');
        res.Data.map(item=>{
          item.time = item.DumpEndTime - item.DumpStartTime
          let d = Math.floor(item.time / 3600 / 24);
          let h = Math.floor((item.time  % 86400) / 3600);
          var m = Math.floor(((item.time % 86400) % 3600) / 60);
          item.time = `${d < 1 ? '' : d}${d < 1 ? '' : '天'} ${h}小时 ${m}分钟`;
          item.CreateTime = parseTime(item.CreateTime)
          item.DumpStartTime = parseTime(item.DumpStartTime)
          item.DumpEndTime = parseTime(item.DumpEndTime)
        })
        this.tableData = res.Data;
      }
    }
}
</script>

<style scoped lang='scss'>
/* @import url(); 引入css类 */
.top{
  display:flex;
  justify-content:space-between;
  align-items: center;
}
// /* cascader 隐藏单选样式 start */
// 	::v-deep .cascader .el-cascader-panel .el-radio {
// 		display: none !important;
// 	}
</style>
<style>
.el-cascader-panel .el-radio {
  display: none;
}
</style>